package com.twu.biblioteca.customer;

import java.util.HashMap;
import java.util.Map;

public class Customer {
	private Map<Integer, Integer> books = new HashMap<Integer, Integer>();
	private String name;
	private String password;
	private String email;
	private String phone;

	public Customer(String name, String password, String email, String phone) {
		this.name = name;
		this.password = password;
		this.email = email;
		this.phone = phone;
	}

	public boolean hasBook(int bookNum) {
		return books.containsKey(bookNum);
	}

	public void borrow(int bookNum) {
		if (books.containsKey(bookNum)) {
			int count = books.get(bookNum);
			books.remove(bookNum);
			books.put(bookNum, count + 1);
		} else {
			books.put(bookNum, 1);
		}
	}

	public String getDetails() {
		return name + " " + email + " " + phone;
	}

	public String getName() {
		return name;
	}

	public String getPassword() {
		return password;
	}

	public String getEmail() {
		return email;
	}

	public String getPhone() {
		return phone;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
}
